gtk-demo: Follow font settings again
authorMatthias Clasen <mclasen@redhat.com>
Sun, 9 Aug 2020 03:38:07 +0000 (23:38 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 9 Aug 2020 03:38:07 +0000 (23:38 -0400)
highlight puts font and size information into
its pango markup; strip that out to make our
text follow font settings again.

demos/gtk-demo/main.c

index d3f65220d08224c88fcc2af6c7600cc5f2edb901..668f3e2d11111ce9ddbf2ad0f9445b68595920a4 100644 (file)
@@ -328,8 +328,13 @@ fontify (const char    *format,
     {
       char *markup;
       gsize len;
+      char *p;
 
       markup = g_bytes_unref_to_data (bytes, &len);
+      /* highlight puts a span with font and size around its output,
+       * which we don't want.
+       */
+      for (p = markup + strlen ("<span "); *p != '>'; p++) *p = ' ';
       gtk_text_buffer_delete (source_buffer, &start, &end);
       gtk_text_buffer_insert_markup (source_buffer, &start, markup, len);
       g_free (markup);